<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>我的钱包</title>

    <!-- Custom fonts for this template-->
    <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
    <link
            href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
            rel="stylesheet">

    <link rel="stylesheet" href="layui/css/layui.css">
    <!-- Custom styles for this template-->
    <link rel="stylesheet" href="css/sb-admin-2.min.css">
    <link rel="stylesheet" href="css/canvas.css">
    <link rel="stylesheet" href="angularjs/pagination.css">
    <link rel="stylesheet" href="layer/layer/theme/default/layer.css">

    <!-- 重要的 Jquery 文件先导入 -->
    <script src="vendor/jquery/jquery.min.js"></script>
    <script src="bootstrap/js/jquery-cookie/jquery.cookie.js"></script>

    <script src="angularjs/angular.min.js"></script>
    <script src="angularjs/pagination.js"></script>
    <script src="layer/layer/layer.js"></script>
    <script src="layui/layui.all.js"></script>

    <script>
        var cookie_user_id = $.cookie("stock_user_id");

        var app = angular.module("myapp", ['pagination']);
        app.controller("mymoney", function ($scope, $http) {

            $scope.paginationConf = {//属性
                currentPage: 1,
                itemsPerPage: 5,//每页5条
                totalItems: 10000,//总共多少条
                perPageOptions: [5, 10, 50, 100],//选择范围
                onChange: function () {
                    $scope.getAllUserByid($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage)
                }
            };
            //有分页的请求；
            var index = -1;
            $scope.getAllUserByid = function (pageIndex, pageSize) {
                index = layer.load(1);
                $scope.userid = cookie_user_id;
                $http.post("users/user/list?userid=" + $scope.userid + "&pageIndex=" + pageIndex + "&pageSize=" + pageSize).success(function (data) {
                    $scope.list = data.rows;    //更新当前页面的数据；
                    $scope.paginationConf.totalItems = data.total;  //更新总记录数；
                    layer.close(index); //关闭动画；
                });
            };

            //充值
            $scope.add = function () {
                var n = document.getElementById("n").value;
                document.getElementById('n').value = null;
                $("#myModal2").modal("show");
            };
            //充值
            $scope.deposit = function () {
                var n = document.getElementById("n").value;
                var regex = /^\d+$/;
                var max = 100;
                if (n == "") {
                    layer.msg("请输入充值金额", {icon: 6});
                    return false;
                }
                if (regex.test(n)) {
                    if (max > n) {
                        // alert("请输入大于"+max+"的金额！！");
                        layer.msg("请输入大于" + max + "的金额！！", {icon: 5});
                        return false
                    }
                } else {
                    //alert("请输入整数");
                    layer.msg("请输入整数", {icon: 5});
                }
                $scope.userid = cookie_user_id;
                $http.get("users/user/topup?userid=" + $scope.userid + "&balance=" + $scope.balance).success(function (data) {
                    if (data.code == 0) {
                        layer.msg("充值成功", {icon: 6});
                        $("#myModal2").modal("hide");
                        $scope.getAllusermoney();//更新余额；
                        $scope.paginationConf.onChange();  //更新账单；
                    } else {
                        layer.msg("充值失败", {icon: 5});
                    }
                });

            };

            //提现
            $scope.tix = function () {
                var b = document.getElementById("b").value;
                document.getElementById('b').value = null;
                $("#myModal").modal("show");
            };

            //提现
            $scope.withdraw = function () {
                var b = document.getElementById("b").value;
                var regex = /^\d+$/;
                var max = 100;
                if (b == "") {
                    layer.msg("请输入提现金额", {icon: 6});
                    return false;
                }
                if (regex.test(b)) {
                    if (max > b) {
                        // alert("请输入大于"+max+"的金额！！");
                        layer.msg("请输入大于" + max + "的金额！！", {icon: 5});
                        return false
                    }
                } else {
                    //alert("请输入整数");
                    layer.msg("请输入整数", {icon: 5});
                }
                $http.post("users/user/withdraw?userid=" + $scope.userid + "&balance=" + $scope.balance).success(function (data) {
                    if (data.code == 0) {
                        layer.msg("提现成功", {icon: 6});
                        $("#myModal").modal("hide");
                        $scope.getAllusermoney();//更新数据
                        $scope.paginationConf.onChange();  //更新账单；
                    } else {
                        layer.msg("提现失败", {icon: 5});
                    }
                });

            };

            //打开常见问题模态框
            $scope.logoutModal = function () {
                $("#logoutModal").modal("show");
            };
            $scope.questionModal = function () {
                $("#questionModal").modal("show");
            };

            //查询登录用户的金额
            $scope.getAllusermoney = function () {
                $scope.userid = cookie_user_id;
                $http.get("users/user/usermoney?userid=" + $scope.userid).success(function (data) {
                    $scope.userbalance = data[0].userbalance;

                })
            };
        });


    </script>


    <style>
        .accountMoney {
            font-size: 36px;
        }

        .accountBtn {
            margin: 10px 20px 10px 0;
        }

        .question-body div {
            font-size: 14px;
            font-weight: bold;
            color: #333;
        }

        .question-body p {
            margin: 2px 0 2px 5px;
            font-size: 14px;
        }

        #ques {
            text-decoration: underline;
        }
    </style>
</head>

<body id="page-top" ng-app="myapp">


<!-- 退出登录弹出 模态框区域 -->
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">系统消息</h5>
                <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
            </div>
            <div class="modal-body">如果您已经准备好结束当前的会话，请选择下面的“确定”</div>
            <div class="modal-footer">
                <button class="btn btn-secondary" type="button" data-dismiss="modal">取消</button>
                <a class="btn btn-primary" href="login.html">确定</a>
            </div>
        </div>
    </div>
</div>
<!-- questionModal 模态框区域 -->
<div class="modal fade" id="questionModal" tabindex="-1" role="dialog" aria-labelledby="problem"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="problem">常见问题</h5>
                <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
            </div>
            <div class="modal-body question-body">
                <div>什么是余额？</div>
                <p>钱包余额是您在东方财富中得到的可以直接提现的奖金。</p>
                <div>提现金额何时到账?</div>
                <p> 您发起提现后，2-3个工作日内，提现金额会到账。如果超过3个打客服电话: 021-24099098反馈问题。</p>
                <div>如何将余额提现?</div>
                <p>1.在钱包余额页面点击"提现"按钮，提现之前必须通过实名认证;</p>
                <p>2.输入提现金额，选择通过支付宝提现;</p>
                <p>3.最后，您账户关联的手机会收到一条验证短信，验证通过后，提3有绑定手机号，需要先绑定才能提现;</p>
                <p>4.申请提交后，通常2-3个工作日内您的支付宝会收到款项;</p>
                <p>5.当月累计提现不能超过800元，单次提现额不能少于1元。 </p>
                <div>钱包余额是如何计算的?</div>
                <p>您的钱包余额等于收入总额减去提现总额，支付和退款交易是不进入钱包的</p>
                <div>钱包在使用中出现问题怎么办?</div>
                <p>您在使用钱包的过程中，如果出现余额错误或无法提现等问题，请关注财富证券，或者拨打客服电话: 021-24099098</p>
            </div>
            <div class="modal-footer">
                <button class="btn btn-secondary" type="button" data-dismiss="modal">确定</button>
            </div>
        </div>
    </div>
</div>

<!-- 整体页面开始 -->
<div id="wrapper">

    <!-- 侧边栏开始 -->
    <ul class="navbar-nav bg-gray-800 sidebar sidebar-dark accordion" id="accordionSidebar">

        <!-- 公司logo与公司名区域 -->
        <a class="sidebar-brand d-flex align-items-center justify-content-center" href="index.html">
            <div class="sidebar-brand-icon rotate-n-15">
                <i class="fas fa-laugh-wink"></i>
            </div>
            <div class="sidebar-brand-text mx-3">金正股份<sup>TM</sup></div>
        </a>

        <!-- 分割线 -->
        <hr class="sidebar-divider my-0 bg-gray-800">

        <!-- 首页模块 -->
        <li class="nav-item active">
            <a class="nav-link" href="index.html">
                <i class="fas fa-fw fa-tachometer-alt"></i>
                <span>首页</span></a>
        </li>

        <!-- 分割线 -->
        <hr class="sidebar-divider bg-gray-800">

        <!-- 股票行情头标题 -->
        <div class="sidebar-heading">
            股票市场
        </div>

        <!-- 热门股票模块 -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseTwo"
               aria-expanded="true" aria-controls="collapseTwo">

                <i class="fas fa-fire fa-cog"></i>

                <span>热门股票</span>
            </a>
<!--            <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
                <div class="bg-white py-2 collapse-inner rounded">
                    <h6 class="collapse-header">Custom Components:</h6>
                    <a class="collapse-item" href="buttons.html">Buttons</a>
                    <a class="collapse-item" href="cards.html">Cards</a>
                </div>
            </div>-->
        </li>

        <!-- 股票行情模块 -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseUtilities"
               aria-expanded="true" aria-controls="collapseUtilities">
                <i class="fas fa-fw fa-chart-area"></i>
                <span>股票行情</span>
            </a>
<!--            <div id="collapseUtilities" class="collapse" aria-labelledby="headingUtilities"
                 data-parent="#accordionSidebar">
                <div class="bg-white py-2 collapse-inner rounded">
                    <h6 class="collapse-header">Custom Utilities:</h6>
                    <a class="collapse-item" href="utilities-color.html">Colors</a>
                    <a class="collapse-item" href="utilities-border.html">Borders</a>
                    <a class="collapse-item" href="utilities-animation.html">Animations</a>
                    <a class="collapse-item" href="utilities-other.html">Other</a>
                </div>
            </div>-->
        </li>

        <!-- 分割线 -->
        <hr class="sidebar-divider bg-gray-800">

        <!-- 交易系统头标题 -->
        <div class="sidebar-heading">
            交易中心
        </div>

        <!-- 股票买入模块 -->

        <li class="nav-item">
            <a class="nav-link" href="buy.html">
                <i class="fas fa-dollar-sign fa-2x"></i>
                <span>股票买入</span></a>
        </li>

        <!-- 股票卖出模块 -->
        <li class="nav-item">
            <a class="nav-link" href="maichu.html">
                <i class="fas fa-outdent"></i>
                <span>股票卖出</span></a>
        </li>

        <!-- 股票撤销模块 -->
        <li class="nav-item">
            <a class="nav-link" href="chedan.html">
                <i class="fas fa-window-close fa-table"></i>
                <span>股票撤销</span></a>
        </li>
        <!-- 分割线 -->
        <hr class="sidebar-divider bg-gray-800">
        <!--用户中心模块-->
        <div class="sidebar-heading">
            用户中心
        </div>
        <!-- 个人股票模块 -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsePages"
               aria-expanded="true" aria-controls="collapsePages">
                <i class="fas fa-warehouse fa-folder"></i>
                <span>我的股票</span>
            </a>
            <div id="collapsePages" class="collapse" aria-labelledby="headingPages" data-parent="#accordionSidebar">
                <div class="bg-gray-200 py-2 collapse-inner rounded">
                    <h6 class="collapse-header" style="color:gray">股仓</h6>
                    <a class="collapse-item" href="pos.html"> <i class="fas fa-arrow-right"></i>持仓</a>
                    <a class="collapse-item" href="chengjiao.html"> <i class="fas fa-arrow-right"></i>成交</a>
                    <a class="collapse-item" href="weituo.html"> <i class="fas fa-arrow-right"></i>委托</a>
                </div>
            </div>
        </li>

        <!-- 个人中心模块 -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#center" aria-expanded="true"
               aria-controls="center">
                <i class="fas fa-user-astronaut fa-folder"></i>
                <span>个人中心</span>
            </a>
            <div id="center" class="collapse" aria-labelledby="headingPages" data-parent="#accordionSidebar">
                <div class="bg-gray-200 py-2 collapse-inner rounded">
                    <a class="collapse-item" href="setting.html"> <i class="fas fa-user-cog">&nbsp;</i>设置</a>
                    <a class="collapse-item" href="wallet.html"> <i class="fas fa-wallet">&nbsp;</i>钱包</a>
                </div>
            </div>
        </li>

        <!-- Divider -->
        <hr class="sidebar-divider d-none d-md-block bg-gray-800">

        <!-- Sidebar Toggler (Sidebar) -->
        <div class="text-center d-none d-md-inline">
            <button class="rounded-circle border-0" id="sidebarToggle"></button>
        </div>

    </ul>
    <!-- 侧边栏结束 -->

    <!-- 右侧内容区域 -->
    <div id="content-wrapper" class="d-flex flex-column">

        <!-- 主要内容 -->
        <div id="content">

            <!-- 顶部框 -->
            <nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">

                <!-- Topbar Navbar -->
                <ul class="navbar-nav ml-auto">

                    <!-- Nav Item - Search Dropdown (Visible Only XS) -->
                    <li class="nav-item dropdown no-arrow d-sm-none">
                        <a class="nav-link dropdown-toggle" href="#" id="searchDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <i class="fas fa-search fa-fw"></i>
                        </a>
                        <!-- Dropdown - Messages -->
                        <div class="dropdown-menu dropdown-menu-right p-3 shadow animated--grow-in"
                             aria-labelledby="searchDropdown">
                            <form class="form-inline mr-auto w-100 navbar-search">
                                <div class="input-group">
                                    <input type="text" class="form-control bg-light border-0 small"
                                           placeholder="Search for..." aria-label="Search"
                                           aria-describedby="basic-addon2">
                                    <div class="input-group-append">
                                        <button class="btn btn-primary" type="button">
                                            <i class="fas fa-search fa-sm"></i>
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </li>

                    <!-- 个人中心模块 -->
                    <li class="nav-item dropdown no-arrow">
                        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <span class="mr-2 d-none d-lg-inline text-gray-600 small">{{user.username}}</span>
                            <img class="img-profile rounded-circle" src="img/headpic.jpg">
                        </a>
                        <!-- Dropdown - User Information -->
                        <div class="dropdown-menu dropdown-menu-right shadow animated--grow-in"
                             aria-labelledby="userDropdown">
                            <a class="dropdown-item" href="openAccount.html">
                                <i class="fas fa-cogs fa-sm fa-fw mr-2 text-gray-400"></i>
                                开户
                            </a>
                            <a class="dropdown-item" href="login.html">
                                <i class="fas fa-user-circle fa-sm fa-fw mr-2 text-gray-400"></i>
                                登录
                            </a>
                            <a class="dropdown-item" href="register.html">
                                <i class="fas fa-user-plus fa-sm fa-fw mr-2 text-gray-400"></i>
                                注册
                            </a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">
                                <i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
                                退出登录
                            </a>
                        </div>
                    </li>

                </ul>
            </nav>
            <!-- 顶部框结束 -->

            <!-- 页面内容开始 -->
            <div class="layui-tab container-fluid">
                <ul class="layui-tab-title">
                    <li class="layui-this">钱包</li>
                    <li>账单记录</li>
                </ul>

                <!-- 标签页内容开始 -->
                <div class="layui-tab-content" ng-controller="mymoney" ng-init="getAllusermoney()">
                    <!-- 第一个标签页---------第一个标签页------------第一个标签页 -->
                    <div class="layui-tab-item layui-show ">
                        <div>
                            <div class="accountMoney">
                                <i class="fa fa-hand-holding-usd fa-1x" style="color: red" aria-hidden="true"></i>账户余额：
                                <sup></sup>
                                <span id="tz" style="color: #e02d1b;font-size: 36px">￥</span>
                                <span class="ramian-num" id="userbalance" ng-model="userbalance"
                                      style="color: #e02d1b;font-size: 30px;font-weight: bolder">{{userbalance == ""||userbalance==null?0:userbalance}}</span>
                            </div>
                            <div>
                                <button id="addBtn" ng-click="add()" class="btn btn-primary accountBtn">充值</button>
                                <button id="outBtn" ng-click="tix()" class="btn btn-primary accountBtn">提现</button>
                            </div>
                            <div id="td" class="income-info clearfix">
                                <div class="account-right">
                                    <div class="income-explain dsHide" id="income_explain">
                                        <span>因结算周期限制，每笔收入扣除手续费24小时后转入账户余额</span>
                                    </div>
                                </div>
                            </div>
                            <div class="common-qustion">
                                <a href="javascript:;" id="ques" ng-click="questionModal()">常见问题</a>
                            </div>
                        </div>
                    </div>
                    <!-- 第一个标签页结束 -->

                    <!-- 第二个标签页----------第二个标签页-----------第二个标签页 -->
                    <div class="layui-tab-item card-body p-2">
                        <table class="table table-condensed table-striped table-bordered table-hover text-center">
                            <tr>
                                <td>编号</td>
                                <td>时间</td>
                                <td>金额</td>
                                <td>状态</td>
                            </tr>
                            <tr ng-repeat="u in list">
                                <td>{{$index+1}}</td>
                                <td>{{ u.tradtime | date:'yyyy-MM-dd HH:mm:ss' }}</td>
                                <td>{{u.tradmoney}}</td>
                                <td>{{u.tradstate == 0?"收款":"支出"}}</td>
                            </tr>

                            <tr>
                                <td colspan="4">
                                    <!--//自动分页的标签！！！-->
                                    <tm-pagination conf="paginationConf"></tm-pagination>
                                </td>
                            </tr>
                        </table>

                    </div><!-- 第二个标签页结束 -->


                    <!--提现模态框-->
                    <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                         aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-body">
                                    <button class="close" data-dismiss="modal">
                                        <span>×</span>
                                    </button>
                                </div>
                                <div class="modal-title">
                                    <h1 class="text-center" style="color: blue">提现</h1>
                                </div>
                                <div class="modal-body">
                                    <form class="form-group">
                                        <table class="table table-hover table-bordered table-condensed table-striped text-center"
                                               style="width: 400px;margin:auto">

                                            <tr>
                                                <td><span style="color: #999999">请输入提现金额:</span>
                                                    <input name="balance" id="b" ng-model="balance">
                                                </td>
                                            </tr>
                                        </table>
                                    </form>
                                    <div class="text-right">
                                        <a class="btn btn-primary" style="color: whitesmoke"
                                           ng-click="withdraw()">确认</a>
                                        <button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!--充值模态框-->
                    <div id="myModal2" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                         aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-body">
                                    <button class="close" data-dismiss="modal">
                                        <span>×</span>
                                    </button>
                                </div>
                                <div class="modal-title">
                                    <h1 class="text-center" style="color: red">充值</h1>
                                </div>
                                <div class="modal-body">
                                    <form class="form-group">
                                        <table class="table table-hover table-bordered table-condensed table-striped text-center"
                                               style="width: 400px;margin:auto">

                                            <tr>
                                                <td><span style="color: #999999">请输入充值金额:</span>
                                                    <input id="n" ng-model="balance">
                                                </td>
                                            </tr>
                                        </table>
                                    </form>
                                    <div class="text-right">
                                        <a class="btn btn-primary" style="color: white" ng-click="deposit()">确认</a>
                                        <button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


                </div><!-- 标签页内容结束 -->
            </div><!-- /.container-fluid -->
        </div>
        <!-- 主要内容结束 -->

        <!-- 页脚 -->
        <footer class="sticky-footer bg-white">
            <div class="container my-auto">
                <div class="copyright text-center my-auto">
                    <span>Copyright &copy; Your Website 2020</span>
                </div>
            </div>
        </footer>
        <!-- 页脚结束 -->

    </div>
    <!-- 右侧内容区域结束 -->

</div>
<!-- 整体页面结束 -->

<!-- 滚动到顶部按钮-->
<a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
</a>


<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<script src="js/sb-admin-2.min.js"></script>

</body>

</html>